module(..., package.seeall)

actions = {}

actions.rss = function(page, params, sputnik)
   local history = sputnik:get_history(nil, 50) 
   return cosmo.fill(page.templates.RSS, {  
      title   = "Recent Wiki Edits",
      baseurl = sputnik.config.BASE_URL, 
      items   = function()
		   for i, page in ipairs(history) do
		      cosmo.yield{
			 link        = "http://" .. sputnik.config.DOMAIN ..
			               sputnik:escape_url(
					  page.urls:show{version=page.version}
				       ),
			 title       = string.format("%s: %s by %s",
						     page.version,
						     page.title,
						     page.author),
			 ispermalink = "false",
			 guid        = page.name .. "/" .. page.version,
		         summary     = page.summary
		      }
		   end
		end,
   }), "application/rss+xml"
end

